const app = getApp();

Page({
    data: {
		resourceDomain:'//resource.160nurse.com/'
    },
    lottery_gain() {
        var that=this
        app.request(
            app.apiDomain + "index.php?c=pond&a=prize",
            {},
            function(res){
                // console.log(res)
                if(res.data.status==1){
                    that.setData({
                        lottery_gain_list:res.data.data.list
                    })
                }else{
                    wx.showToast({
                        title: '网络原因，请刷新页面！',
                        icon: "none",
                        duration: 3000
                    })
                }
            }
        )
    },
    get_btn(e){
        var that=this
		this.dataset = e.currentTarget.dataset;
		wx.showLoading({
			title: '领取中',
		})
        app.request(
            app.apiDomain + "index.php?c=pond&a=send",
            {
                id:that.dataset.id
            },
            function(res){
				// console.log(res.data)
				wx.hideLoading();
                if(res.data.status==1){
                    wx.showToast({
                        title: res.data.info,
                        icon: "none",
                        duration: 3000
                    })
                    that.onReady()
                }else{
                    wx.showToast({
                        title: res.data.info,
                        icon: "none",
                        duration: 3000
                    })
                }
            }
        )
    },
    to_submit(e){
		this.dataset = e.currentTarget.dataset;
        wx.navigateTo({
            url:"../Order/submit?goods_id="+this.dataset.goodsid+"&id="+this.dataset.id+'&type=pond&sku=0'
       })
    },
    onReady(){
        this.lottery_gain()
    }
})